package com.lty.practice.mapper;

import com.lty.practice.model.Coffee;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.session.RowBounds;

import java.util.List;

@Mapper
public interface CoffeeMapper {
//    @Select("select * from t_coffee order by id")
//    List<Coffee> findAllWithRowBounds(RowBounds rowBounds);

    @Select("select * from t_coffee order by id desc")
    List<Coffee> findAllWithParamById(@Param("pageNum") int pageNum,
                                  @Param("pageSize") int pageSize);
    List<Coffee> selectByPrimaryKeys(@Param("ids") Long[] ids,
                                     @Param("pageNum") int pageNum,
                                     @Param("pageSize") int pageSize);
    List<Coffee> testAppendSql(@Param("appendSql") String appendSql);
//    @Select({
//            "select",
//            "ID, CREATE_TIME, UPDATE_TIME, NAME, PRICE",
//            "from T_COFFEE",
//            "where ID = #{id,jdbcType=BIGINT}"
//    })
//    @ResultMap("com.lty.practice.mapper.CoffeeMapper.BaseResultMap")
    Coffee selectByPrimaryKey(Long id);

    int insertSelective(Coffee record);

    int updateByPrimaryKeySelective(Coffee record);

    @Delete({
            "delete from T_COFFEE",
            "where ID = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    List<Coffee> selectByCondition(Coffee record);
}
